UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q3LdTAyr2LSHufIWLwwyK3wp013lSr0dP00cOx9/4nk=' 
WHERE 
  key_id = 'b23cc0e1d3edc15393d1a9b2d746370a7ba6fc31a5e2b30fbb5f1174f263058f' 
  AND (
    token = 'q3LdTAyr2LSHufIWLwwyK3wp013lSr0dP00cOx9/4nk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026