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