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