UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fUutGrUHrA9mU31F26mhkzzVatoVAmnl0YOplnQUBTA=' 
WHERE 
  key_id = 'f1a2e5a684cffa15539efd781439af6b20a90ce8fb6d28e49d645781ee5bcac3' 
  AND (
    token = 'fUutGrUHrA9mU31F26mhkzzVatoVAmnl0YOplnQUBTA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032