UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UJJHT9oEyTaEAO/B3T+TwhfzXvk8W57zGkrCT5WH7MM=' 
WHERE 
  key_id = 'ce6dcacd2b3d1605f2f671621feae9ff8f97bed8672b4b2cdd4414f20025bab9' 
  AND (
    token = 'UJJHT9oEyTaEAO/B3T+TwhfzXvk8W57zGkrCT5WH7MM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023