UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '74YAC57+xWq5ix2SxW4cV+BdyuCJYVMgfv6DSmmOvqE=' 
WHERE 
  key_id = '40473e0a598c3ad764d616183abdd04842f9f0c6862d0e9755dcff523f346176' 
  AND (
    token = '74YAC57+xWq5ix2SxW4cV+BdyuCJYVMgfv6DSmmOvqE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027