UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5I/CzjtNxh+dWPt+WZEIwNXTgF+y0O1jx4RKkuVRRJ8='
WHERE
key_id = 'd555577041b9aac643a6a885762d2d38a8f1e65afd1cadf1729f7f7dd16d69cd'
AND (
token = '5I/CzjtNxh+dWPt+WZEIwNXTgF+y0O1jx4RKkuVRRJ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)