UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AksJ33+1ishSVgX0K2nogLu/oYW8h5G7/E+YtNAYlww='
WHERE
key_id = 'a05445ea03ecfdf2645c8485bb58546a99e552bb95fff769d60572d15fb4d3bd'
AND (
token = 'AksJ33+1ishSVgX0K2nogLu/oYW8h5G7/E+YtNAYlww='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)