UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5OsDF8sg6XGx6h+9HunxQPhvzgGahT/mkssx9C5B87Y='
WHERE
key_id = 'dedb1f822c357573a14d7d4ea7fcd37cb747739c18a503f97ff827f15bb4d6e4'
AND (
token = '5OsDF8sg6XGx6h+9HunxQPhvzgGahT/mkssx9C5B87Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)