UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BnFsQn07v/ViAH3G1WKYByvd0f0XKRG0ngXaxos1nrA='
WHERE
key_id = '6635fcc578bdc79b617a39778f5a15a52825a8d1359594457e18ea03ba6ab285'
AND (
token = 'BnFsQn07v/ViAH3G1WKYByvd0f0XKRG0ngXaxos1nrA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)