UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OJpAM8Q0vBUqsy4a7nvQg1z9N8EdKhT2JwBblVBfXV8=' 
WHERE 
  key_id = '6d731a6998d489eea69fac991af3119ee78a62f2ddee80fd3012aa9059492c8d' 
  AND (
    token = 'OJpAM8Q0vBUqsy4a7nvQg1z9N8EdKhT2JwBblVBfXV8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026