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