UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c56HQeQk4piWjyW+H4BIppdOvosekZybBxXA6He8VPY='
WHERE
key_id = 'bdd75aa16c131848c2afae2d00b4597c2f8f63dce78e79853516d65fac0a9537'
AND (
token = 'c56HQeQk4piWjyW+H4BIppdOvosekZybBxXA6He8VPY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)