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