UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5h22K7pCzOZJST2YBBYN5gqGKn2J3d9K0+F2pqNNkF8='
WHERE
key_id = '456bb99afd5cd66edbfbb185a06d28b9a564e4b14650680e50bc9d0683ee8a90'
AND (
token = '5h22K7pCzOZJST2YBBYN5gqGKn2J3d9K0+F2pqNNkF8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)