UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8JW61956wtXigaDY62KMk/ORVkPj4jrK0CV6fPaRE6c='
WHERE
key_id = '6a0c37d5bb97eb0043d2f083fb1899998b8f2ca298356203254417b9e0142b28'
AND (
token = '8JW61956wtXigaDY62KMk/ORVkPj4jrK0CV6fPaRE6c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)