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