UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gca00N43Reggk2kB8T3gLlx38WxnnINPZEfVQfpGh7E='
WHERE
key_id = '9fed01887ddf42b81534602a0c73bfda6269eb7707f4395e21a0361be0d09b6d'
AND (
token = 'gca00N43Reggk2kB8T3gLlx38WxnnINPZEfVQfpGh7E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)