UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Zjg7jt11/yIgXdIOvA5pgUggbThtBuDdjnfCjaXHKFA='
WHERE
key_id = 'd3dbfff998b378ab6625c80819e8f0f7b38a38ddb52c481a609296057ffdac58'
AND (
token = 'Zjg7jt11/yIgXdIOvA5pgUggbThtBuDdjnfCjaXHKFA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)