UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cW8OHyk2kotW95j1/m0Xg49FEcn9tD5R/bdRe5dDhfg='
WHERE
key_id = 'c33d8f176e4d8ed87270798ec56a2adc9594c86ddd9cd7badfce227945a4416d'
AND (
token = 'cW8OHyk2kotW95j1/m0Xg49FEcn9tD5R/bdRe5dDhfg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)