UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VAwR0XksPR8QidOTKPLSEm4FrokyRDSa/fvPWkm+pNs=' 
WHERE 
  key_id = 'ffa0b5e3395efd250789eca7573927d1f4cb39d1894fef3dda144b44eab7fed5' 
  AND (
    token = 'VAwR0XksPR8QidOTKPLSEm4FrokyRDSa/fvPWkm+pNs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027