UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JX5XVG3uprDTdCk81MVwiYh0RzULUz0ileEivLzhrf4='
WHERE
key_id = '9e88db1c3ca52b04e9fae6607d4e49ca0505fe9c36cefe2d31b8754d2c146860'
AND (
token = 'JX5XVG3uprDTdCk81MVwiYh0RzULUz0ileEivLzhrf4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)