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