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