UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fN20YwHMLXh3A1uQRptqlae8Pbo/Lg3WCO7rW8pUJSk='
WHERE
key_id = '6489b32381ef4d8e9e8b6b220bd987be482c7d3b0490b428f173410585028f01'
AND (
token = 'fN20YwHMLXh3A1uQRptqlae8Pbo/Lg3WCO7rW8pUJSk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)