UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kwy20m0NC36sUEaUxHMO7AzYod/zoNk/EibA44mWrPc='
WHERE
key_id = '2c47e186dc4e385599b670239a27f0b4375922fab5a516f1c291e0f14940af91'
AND (
token = 'kwy20m0NC36sUEaUxHMO7AzYod/zoNk/EibA44mWrPc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)