UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BIxv1nXwuu66Qsvjc3PrwAV3aHzauj/O+zxMIkEgG5w='
WHERE
key_id = 'd1370f8d7a4d5c7629a1fb7dc808e8e3862b7bf778a96410cc254800bc2ddb08'
AND (
token = 'BIxv1nXwuu66Qsvjc3PrwAV3aHzauj/O+zxMIkEgG5w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)