UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AT5HfD0ZYOYc7ky2CdykIRObYjprR5XFMT6x3y7d32k='
WHERE
key_id = '1d90c5fce6b3b73b819073c451c7c0b83002a1918e9d82379e6c35d8c22b33e6'
AND (
token = 'AT5HfD0ZYOYc7ky2CdykIRObYjprR5XFMT6x3y7d32k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)