UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TxNnAksIN+l/+K1iXu7jN443VRlNNzEVmgB+QdjGPGA='
WHERE
key_id = 'f61882d227270fe6d24a90f4be2e62e3414c0e09c289abc3cb85846ab9af5669'
AND (
token = 'TxNnAksIN+l/+K1iXu7jN443VRlNNzEVmgB+QdjGPGA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)