UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gFHGwrYtEgfraBvQ8ZypR0urRM+xpLvHjNVbm7cWifs='
WHERE
key_id = 'cbeedd33cba50419df99a6efd3983bc99efee0650afcc1aa50efe7e8e87cf5c7'
AND (
token = 'gFHGwrYtEgfraBvQ8ZypR0urRM+xpLvHjNVbm7cWifs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)