UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ShKNa1OStK9+cMQPKgFiDgn9dgST2aGkqffBOAN2N4E='
WHERE
key_id = 'a4bba7d60de97343a0f77877e87a87ceb40340be4c114b1921fec0dc25d2c30c'
AND (
token = 'ShKNa1OStK9+cMQPKgFiDgn9dgST2aGkqffBOAN2N4E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)