UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0I8q9hqiMyaLZvY+MYmksMgT5xkFSt72aLIZbiLQfIk='
WHERE
key_id = '362872d65d8cade1ee8235b23d3cd5716b69e2a8c952772104e9a674110c841e'
AND (
token = '0I8q9hqiMyaLZvY+MYmksMgT5xkFSt72aLIZbiLQfIk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)