UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WqOVVk+umO71twzlYY9OqEzMdYPsOX4/aSt7uU7OAXM='
WHERE
key_id = 'e9dcccaa84223476aff2316b7bbb4be23c8389cdb494c3537579cb3504284541'
AND (
token = 'WqOVVk+umO71twzlYY9OqEzMdYPsOX4/aSt7uU7OAXM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)