UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ri2lVrbtJz5u7BrcE2AHcJWKiq3LsyADR8xVQ/s5LwM=' 
WHERE 
  key_id = 'f2ba3c9a1bf6565c5d78eea9d6fa89f207049ca5d3f5094e1f0a71b5555d229d' 
  AND (
    token = 'Ri2lVrbtJz5u7BrcE2AHcJWKiq3LsyADR8xVQ/s5LwM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043