UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9peAyjRg10YG0M5GcfkATUvHEt1Tuy0Qk+/be+y5nf0=' 
WHERE 
  key_id = '15678edd70650626587c730acd35ed8a0505de2fd9174d534a43b13789f29c06' 
  AND (
    token = '9peAyjRg10YG0M5GcfkATUvHEt1Tuy0Qk+/be+y5nf0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029