UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aP1uEIoayXzMt18zC0MlnL6TWte4MZFt/a/fHgOVZaA='
WHERE
key_id = '3125fefbb3a372b2b39d469a4abc97720b789821fff5641025097d3160a9bad1'
AND (
token = 'aP1uEIoayXzMt18zC0MlnL6TWte4MZFt/a/fHgOVZaA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)