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