UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l5F/5fZzq18vC2StdJF7Y1fDh2+NknQCbIUNDJF0mNc=' 
WHERE 
  key_id = 'f5caeabbfbc5604107d8ecec9215eba142cfde1058cc879dd196aba6c49eca4a' 
  AND (
    token = 'l5F/5fZzq18vC2StdJF7Y1fDh2+NknQCbIUNDJF0mNc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039