UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VlRg9kb2vB5wZ9UtEtYjFtH29rvvToab/NOIIu6eYzs='
WHERE
key_id = '412e3dd8f89830175b6896adc09666c0fc08547e51dbe0beee4370ada4c305e3'
AND (
token = 'VlRg9kb2vB5wZ9UtEtYjFtH29rvvToab/NOIIu6eYzs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)