UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TSchOZrbmsr+RRAaexYyJRDwG7ysmNrwNKGvYkZ0d8k='
WHERE
key_id = 'dafa6c2ee8d54222a7db8202d2bdbd3830244b896680fd092fec7c8691ec447a'
AND (
token = 'TSchOZrbmsr+RRAaexYyJRDwG7ysmNrwNKGvYkZ0d8k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)