UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3t+j3LoHObYiPK5fkKzS3iGH3kLq1m8k2hWiwbCk09Q='
WHERE
key_id = '8c9d3c197d59226f568497b6a762f5394ef04b5d06435990f6aed4f2830ecec0'
AND (
token = '3t+j3LoHObYiPK5fkKzS3iGH3kLq1m8k2hWiwbCk09Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)