UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tiXaY09CyTTjjplA+tiyBnScpoDRq6jtPJxrz0zjvQ8='
WHERE
key_id = '0775f883762bfc93be2a99d569a934a4101aab3aefd60acbf601eef19d682134'
AND (
token = 'tiXaY09CyTTjjplA+tiyBnScpoDRq6jtPJxrz0zjvQ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)