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