UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DPLLFeh9e6GDQzgIzsK5RTI5VA6qsbsi8CTGbvzzJxg=' 
WHERE 
  key_id = '7a4f80d4631606ac6b3227df1b64f17d25dbf088aebf581438d13ca165615fe9' 
  AND (
    token = 'DPLLFeh9e6GDQzgIzsK5RTI5VA6qsbsi8CTGbvzzJxg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030