UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UdEzepxl3XcWYU4VmQawONxJCsMPrkkC36Wa4ufZQK8='
WHERE
key_id = '8871fdb28a89bf772e0c68c44e4672c35b58d4b19694462aafd57b3f7df9192b'
AND (
token = 'UdEzepxl3XcWYU4VmQawONxJCsMPrkkC36Wa4ufZQK8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)