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