UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ccccA8qomQoO3YuuAjPRjQIs0Qg+AI7WRPciNUlSdRM=' 
WHERE 
  key_id = '5b12400fc658713fa051ba201caf91e1438b07ebda92b5599af1ebcfd4748ac9' 
  AND (
    token = 'ccccA8qomQoO3YuuAjPRjQIs0Qg+AI7WRPciNUlSdRM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016