UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o+vjoF9ceEjmKT1uz5CvEmHbUtn8kwcKLnYePjr0kl8=' 
WHERE 
  key_id = '358c9fbfecf648d1b375b6eecdb482b954ad5bb4613bedde6e1f4fde7240f546' 
  AND (
    token = 'o+vjoF9ceEjmKT1uz5CvEmHbUtn8kwcKLnYePjr0kl8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030