UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nuj7ZGBGguOR6mSNqYbwqaVqjxc9t6K3bwmL/dRgk94='
WHERE
key_id = 'bf419143cfc40119d2c379dba9b9897365ee828a8e6ad9740310534f9e25e57d'
AND (
token = 'nuj7ZGBGguOR6mSNqYbwqaVqjxc9t6K3bwmL/dRgk94='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)