UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dVzphUo3Ondf1l2eP6ljVAEbccF72f8/wi5zgIEP6Bw=' 
WHERE 
  key_id = '416a75d55e345cd0bc50c73052481083f12e6f0e1ec923b5909070037cb1ad90' 
  AND (
    token = 'dVzphUo3Ondf1l2eP6ljVAEbccF72f8/wi5zgIEP6Bw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048