UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'stlBIikzHwA0SX9rBACAyiLxkwkc4yfg20rOvq5okSQ=' 
WHERE 
  key_id = 'cbbe54bd55fb33dff1942c49dbeb2600d48d5762e5b45e7eb2b8f1553cec2aaf' 
  AND (
    token = 'stlBIikzHwA0SX9rBACAyiLxkwkc4yfg20rOvq5okSQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027